package cn.slipi.core.handler.mapping;

import cn.slipi.core.handler.CoreWebHandler;
import org.springframework.web.reactive.handler.AbstractHandlerMapping;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

public class CoreWebHandlerMapping extends AbstractHandlerMapping {

    private final CoreWebHandler coreWebHandler;

    public CoreWebHandlerMapping(CoreWebHandler coreWebHandler) {
        this.coreWebHandler = coreWebHandler;
        setOrder(1);
    }

    @Override
    protected Mono<?> getHandlerInternal(ServerWebExchange serverWebExchange) {
        return Mono.just(coreWebHandler);
    }
}
